#include "PCH.h"
#include "GameScene.h"
#include "Config.h"

GameScene::GameScene(const std::string &name) :
	IScene(name)
{
}

GameScene::~GameScene(void)
{
}

void GameScene::doInit()
{
	m_view.SetSize(_NUMTILESCRX,_NUMTILESCRY);
	m_view.SetPos(50,50);
	m_world.Init();
}

bool GameScene::doRun()
{
	if (Config::Get()->Update())
		m_view.SetSize(_NUMTILESCRX,_NUMTILESCRY);

	if (KeyDown(KEY_LEFT))
		m_view.Step(-1,0);
	if (KeyDown(KEY_RIGHT))
		m_view.Step(+1,0);
	if (KeyDown(KEY_UP))
		m_view.Step(0,-1);
	if (KeyDown(KEY_DOWN))
		m_view.Step(0,+1);

	m_world.Run(m_view);
	return true;
}
void GameScene::doClose()
{
	m_world.Close();
}